home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Full / Paragon Drive Backup 9 / DB90_SE_x32.msi / Data1.cab / _A79A558DCD8A4586802A91E2A0D3A70D < prev    next >
Extensible Markup Language  |  2008-06-28  |  14KB  |  380 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.1" 
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  4. xmlns:exslt="http://exslt.org/common"
  5. xmlns:math="http://exslt.org/math"
  6. xmlns:str="http://exslt.org/strings"
  7. >
  8.     
  9.     <xsl:output method="text" encoding="UTF-8" indent="no"/>
  10.     <xsl:strip-space elements="*"/>
  11.  
  12.     <xsl:template match="textitem">
  13.         <xsl:element name="textlength"><xsl:value-of select="string-length(.)"/></xsl:element>
  14.     </xsl:template>
  15.     
  16.     <xsl:variable name="g_c1width">
  17.         <xsl:variable name="textitems">
  18.             <textitem>QT_TRANSLATE_NOOP("QObject", "Hard Disk")</textitem>
  19.             <textitem>QT_TRANSLATE_NOOP("QObject", "Serial Number")</textitem>
  20.             <textitem>QT_TRANSLATE_NOOP("QObject", "Capacity")</textitem>
  21.             <textitem>QT_TRANSLATE_NOOP("QObject", "Object")</textitem>
  22.             <textitem>QT_TRANSLATE_NOOP("QObject", "Free Space Only")</textitem>
  23.             <textitem>QT_TRANSLATE_NOOP("QObject", "Start Time")</textitem>
  24.             <textitem>QT_TRANSLATE_NOOP("QObject", "End Time")</textitem>
  25.             <textitem>QT_TRANSLATE_NOOP("QObject", "Name")</textitem>
  26.             <textitem>QT_TRANSLATE_NOOP("QObject", "Description")</textitem>
  27.             <textitem>QT_TRANSLATE_NOOP("QObject", "Write Pass Count")</textitem>
  28.             <textitem>QT_TRANSLATE_NOOP("QObject", "Verify Pass Count")</textitem>
  29.             <textitem>QT_TRANSLATE_NOOP("QObject", "Verify Percent")</textitem>
  30.             <textitem>QT_TRANSLATE_NOOP("QObject", "Total Bad Blocks")</textitem>
  31.             <textitem>QT_TRANSLATE_NOOP("QObject", "List")</textitem>
  32.         </xsl:variable>
  33.         
  34.         <xsl:variable name="textlengths">
  35.             <xsl:apply-templates select="exslt:node-set($textitems)/textitem"/>
  36.         </xsl:variable>
  37.         
  38.         <xsl:value-of select="math:max(exslt:node-set($textlengths)/textlength)"/>
  39.     </xsl:variable>
  40.     
  41.     <xsl:template name="substring-before-last">
  42.         <xsl:param name="input" />
  43.         <xsl:param name="substr" />
  44.  
  45.         <xsl:if test="$substr">
  46.             <xsl:choose>
  47.                 <xsl:when test="contains($input, $substr)">
  48.                     <xsl:variable name="temp" select="substring-after($input, $substr)" />
  49.                     <xsl:value-of select="substring-before($input, $substr)" />
  50.                     <xsl:if test="contains($temp, $substr)">
  51.                         <xsl:value-of select="$substr" />
  52.                         <xsl:call-template name="substring-before-last">
  53.                             <xsl:with-param name="input" select="$temp" />
  54.                             <xsl:with-param name="substr" select="$substr" />
  55.                         </xsl:call-template>
  56.                     </xsl:if>
  57.                 </xsl:when>
  58.                 <xsl:otherwise>
  59.                     <xsl:value-of select="$input"/>
  60.                 </xsl:otherwise>
  61.             </xsl:choose>
  62.         </xsl:if>
  63.     </xsl:template>
  64.     
  65.     <xsl:template name="text_justify">
  66.         <xsl:param name="value" /> 
  67.         <xsl:param name="width" select="10"/>
  68.         <xsl:param name="align" select=" 'left' "/>
  69.  
  70.         <xsl:value-of select="str:align($value, str:padding($width, ' '), $align)"/>
  71.     </xsl:template>
  72.     
  73.     <xsl:template name="list2string">
  74.         <xsl:param name="items"/>
  75.         <xsl:param name="separator" select="', '"/>
  76.         <xsl:choose>
  77.             <xsl:when test="count($items) > 1">
  78.                 <xsl:variable name="head" select="$items[1]"/>
  79.                 <xsl:variable name="tail">
  80.                     <xsl:call-template name="list2string">
  81.                         <xsl:with-param name="items" select="$items[position() != 1]"/>
  82.                         <xsl:with-param name="separator" select="$separator"/>
  83.                     </xsl:call-template>
  84.                 </xsl:variable>
  85.                 <xsl:choose>
  86.                     <xsl:when test="$tail">
  87.                         <xsl:value-of select="concat($head, $separator, $tail)"/>
  88.                     </xsl:when>
  89.                     <xsl:otherwise>
  90.                         <xsl:value-of select="$head"/>
  91.                     </xsl:otherwise>
  92.                 </xsl:choose>
  93.             </xsl:when>
  94.             <xsl:when test="count($items) = 1">
  95.                 <xsl:value-of select="$items[1]"/>
  96.             </xsl:when>
  97.         </xsl:choose>
  98.     </xsl:template>
  99.  
  100.     <xsl:template name="separator">
  101.         <xsl:param name="width" select="80"/>
  102.     
  103.         <xsl:value-of select="str:padding($width, '-')"/><xsl:text> </xsl:text>
  104.     </xsl:template>
  105.  
  106.     <xsl:template name="section">
  107.         <xsl:param name="desc"/>
  108.  
  109.         <xsl:call-template name="separator"/>
  110.  
  111.         <xsl:call-template name="text_justify">
  112.             <xsl:with-param name="value" select="$desc"/>
  113.             <xsl:with-param name="width" select="80"/>
  114.             <xsl:with-param name="align" select=" 'center' "/>
  115.         </xsl:call-template>
  116.         <xsl:text> </xsl:text>
  117.  
  118.         <xsl:call-template name="separator"/>
  119.     </xsl:template>
  120.  
  121.     <xsl:template name="row">
  122.         <xsl:param name="v1"/>
  123.         <xsl:param name="v2"/>
  124.         <xsl:param name="c1width"/>
  125.         <xsl:param name="totalwidth" select="80"/>
  126.         
  127.         <xsl:if test="$v1 or $v2">
  128.             <!-- Cell 1 -->
  129.             <xsl:variable name="c1">
  130.                 <xsl:choose>
  131.                     <xsl:when test="string-length($v1) > $c1width">
  132.                         <xsl:call-template name="substring-before-last">
  133.                             <xsl:with-param name="input" select="substring($v1, 1, $c1width)"/>
  134.                             <xsl:with-param name="substr" select=" ' ' "/>
  135.                         </xsl:call-template>
  136.                     </xsl:when>
  137.                     <xsl:otherwise>
  138.                         <xsl:value-of select="$v1"/>
  139.                     </xsl:otherwise>
  140.                 </xsl:choose>
  141.             </xsl:variable>
  142.  
  143.             <!-- Cell 2 -->
  144.             <xsl:variable name="c2">
  145.                 <xsl:choose>
  146.                     <xsl:when test="string-length($v2) > ($totalwidth - $c1width - 1)">
  147.                         <xsl:call-template name="substring-before-last">
  148.                             <xsl:with-param name="input" select="substring($v2, 1, $totalwidth - $c1width - 1)"/>
  149.                             <xsl:with-param name="substr" select=" ' ' "/>
  150.                         </xsl:call-template>
  151.                     </xsl:when>
  152.                     <xsl:otherwise>
  153.                         <xsl:value-of select="$v2"/>
  154.                     </xsl:otherwise>
  155.                 </xsl:choose>
  156.             </xsl:variable>
  157.  
  158.             <xsl:call-template name="text_justify">
  159.                 <xsl:with-param name="value" select="$c1"/>
  160.                 <xsl:with-param name="width" select="$c1width"/>
  161.             </xsl:call-template>
  162.             <xsl:text> </xsl:text>
  163.             <xsl:value-of select="$c2"/>
  164.             <xsl:text> </xsl:text>
  165.  
  166.             <xsl:call-template name="row">
  167.                 <xsl:with-param name="v1" select="substring($v1, string-length($c1) + 2)"/>
  168.                 <xsl:with-param name="v2" select="substring($v2, string-length($c2) + 2)"/>
  169.                 <xsl:with-param name="c1width" select="$c1width"/>
  170.                 <xsl:with-param name="totalwidth" select="$totalwidth"/>
  171.             </xsl:call-template>
  172.         </xsl:if>
  173.     </xsl:template>
  174.     
  175.     <xsl:template name="simplerow">
  176.         <xsl:param name="v1"/>
  177.         <xsl:param name="width"/>
  178.         <xsl:param name="totalwidth" select="80"/>
  179.         
  180.         <xsl:if test="$v1">
  181.             <xsl:variable name="c1">
  182.                 <xsl:choose>
  183.                     <xsl:when test="string-length($v1) > $width">
  184.                         <xsl:call-template name="substring-before-last">
  185.                             <xsl:with-param name="input" select="substring($v1, 1, $width)"/>
  186.                             <xsl:with-param name="substr" select=" ' ' "/>
  187.                         </xsl:call-template>
  188.                     </xsl:when>
  189.                     <xsl:otherwise>
  190.                         <xsl:value-of select="$v1"/>
  191.                     </xsl:otherwise>
  192.                 </xsl:choose>
  193.             </xsl:variable>
  194.  
  195.             <xsl:value-of select="$c1"/>
  196.             <xsl:text> </xsl:text>
  197.  
  198.             <xsl:call-template name="simplerow">
  199.                 <xsl:with-param name="v1" select="substring($v1, string-length($c1) + 2)"/>
  200.                 <xsl:with-param name="width" select="$width"/>
  201.                 <xsl:with-param name="totalwidth" select="$totalwidth"/>
  202.             </xsl:call-template>
  203.         </xsl:if>
  204.     </xsl:template>
  205.     
  206.     <xsl:template match="/wipereport">
  207.         <xsl:text><![CDATA[QT_TRANSLATE_NOOP("QObject", "Data Sanitization Report (<WiperProductFullNameWithVersion>)")]]> </xsl:text>
  208.         <xsl:text>QT_TRANSLATE_NOOP("QObject", "Check the data erased according to the following requirements:") </xsl:text>
  209.  
  210.         <!-- HDD Info -->
  211.         <xsl:apply-templates select="hddinfo"/>
  212.         <!-- General Info -->
  213.         <xsl:apply-templates select="operation"/>
  214.         <!-- Algorithm Info -->
  215.         <xsl:apply-templates select="algorithm"/>
  216.         <!-- Bad Blocks Info -->
  217.         <xsl:apply-templates select="badblocks"/>
  218.         <!-- Dump -->
  219.         <xsl:apply-templates select="sectors"/>
  220.         <!-- Last Line -->
  221.         <xsl:call-template name="separator"/>
  222.     </xsl:template>
  223.     
  224.     <!-- Hard Drive Information -->
  225.     <xsl:template match="hddinfo">
  226.         <xsl:call-template name="section">
  227.             <xsl:with-param name="desc">QT_TRANSLATE_NOOP("QObject", "Hard Disk Info")</xsl:with-param>
  228.         </xsl:call-template>
  229.         
  230.         <xsl:call-template name="row">
  231.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Hard Disk")</xsl:with-param>
  232.             <xsl:with-param name="v2" select="name"/>
  233.             <xsl:with-param name="c1width" select="$g_c1width"/>
  234.         </xsl:call-template>
  235.  
  236.         <xsl:if test="string-length(serial) != 0">
  237.             <xsl:call-template name="row">
  238.                 <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Serial Number")</xsl:with-param>
  239.                 <xsl:with-param name="v2" select="serial"/>
  240.                 <xsl:with-param name="c1width" select="$g_c1width"/>
  241.             </xsl:call-template>
  242.         </xsl:if>
  243.  
  244.         <xsl:call-template name="row">
  245.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Capacity")</xsl:with-param>
  246.             <xsl:with-param name="v2" select="capasity"/>
  247.             <xsl:with-param name="c1width" select="$g_c1width"/>
  248.         </xsl:call-template>
  249.     </xsl:template>
  250.  
  251.     <!-- General Information -->
  252.     <xsl:template match="operation">
  253.         <xsl:call-template name="section">
  254.             <xsl:with-param name="desc">QT_TRANSLATE_NOOP("QObject", "General Info")</xsl:with-param>
  255.         </xsl:call-template>
  256.         
  257.         <xsl:call-template name="row">
  258.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Object")</xsl:with-param>
  259.             <xsl:with-param name="v2" select="object"/>
  260.             <xsl:with-param name="c1width" select="$g_c1width"/>
  261.         </xsl:call-template>
  262.  
  263.         <xsl:call-template name="row">
  264.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Free Space Only")</xsl:with-param>
  265.             <xsl:with-param name="v2">
  266.                 <xsl:choose>
  267.                     <xsl:when test="object/@onlyFreeSpace=1">
  268.                         <xsl:text>QT_TRANSLATE_NOOP("QObject", "Yes")</xsl:text>
  269.                     </xsl:when>
  270.                     <xsl:otherwise>
  271.                         <xsl:text>QT_TRANSLATE_NOOP("QObject", "No")</xsl:text>
  272.                     </xsl:otherwise>
  273.                 </xsl:choose>
  274.             </xsl:with-param>
  275.             <xsl:with-param name="c1width" select="$g_c1width"/>
  276.         </xsl:call-template>
  277.  
  278.         <xsl:call-template name="row">
  279.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Start Time")</xsl:with-param>
  280.             <xsl:with-param name="v2" select="starttime"/>
  281.             <xsl:with-param name="c1width" select="$g_c1width"/>
  282.         </xsl:call-template>
  283.  
  284.         <xsl:call-template name="row">
  285.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "End Time")</xsl:with-param>
  286.             <xsl:with-param name="v2" select="finishtime"/>
  287.             <xsl:with-param name="c1width" select="$g_c1width"/>
  288.         </xsl:call-template>
  289.     </xsl:template>
  290.     
  291.     <!-- Algorithm Information -->
  292.     <xsl:template match="algorithm">
  293.         <xsl:call-template name="section">
  294.             <xsl:with-param name="desc">QT_TRANSLATE_NOOP("QObject", "Algorithm Info")</xsl:with-param>
  295.         </xsl:call-template>
  296.  
  297.         <xsl:call-template name="row">
  298.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Name")</xsl:with-param>
  299.             <xsl:with-param name="v2" select="name"/>
  300.             <xsl:with-param name="c1width" select="$g_c1width"/>
  301.         </xsl:call-template>
  302.         
  303.         <xsl:call-template name="row">
  304.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Description")</xsl:with-param>
  305.             <xsl:with-param name="v2" select="description"/>
  306.             <xsl:with-param name="c1width" select="$g_c1width"/>
  307.         </xsl:call-template>
  308.         
  309.         <xsl:call-template name="row">
  310.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Write Pass Count")</xsl:with-param>
  311.             <xsl:with-param name="v2" select="writepass"/>
  312.             <xsl:with-param name="c1width" select="$g_c1width"/>
  313.         </xsl:call-template>
  314.         
  315.         <xsl:call-template name="row">
  316.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Verify Pass Count")</xsl:with-param>
  317.             <xsl:with-param name="v2" select="verifypass"/>
  318.             <xsl:with-param name="c1width" select="$g_c1width"/>
  319.         </xsl:call-template>
  320.         
  321.         <xsl:call-template name="row">
  322.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Verify Percent")</xsl:with-param>
  323.             <xsl:with-param name="v2" select="verifyPercent"/>
  324.             <xsl:with-param name="c1width" select="$g_c1width"/>
  325.         </xsl:call-template>
  326.     </xsl:template>
  327.     
  328.     <!-- Bad Blocks Information -->
  329.     <xsl:template match="badblocks">
  330.         <xsl:call-template name="section">
  331.             <xsl:with-param name="desc">QT_TRANSLATE_NOOP("QObject", "Bad Blocks Info")</xsl:with-param>
  332.         </xsl:call-template>
  333.         
  334.         <xsl:call-template name="row">
  335.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Total Bad Blocks")</xsl:with-param>
  336.             <xsl:with-param name="v2" select="count"/>
  337.             <xsl:with-param name="c1width" select="$g_c1width"/>
  338.         </xsl:call-template>
  339.  
  340.         <xsl:variable name="badblocks" select="list/badblock"/>
  341.         <xsl:choose>
  342.             <xsl:when test="count($badblocks) > 0">
  343.                 <xsl:call-template name="row">
  344.                     <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "List")</xsl:with-param>
  345.                     <xsl:with-param name="v2">
  346.                         <xsl:call-template name="list2string">
  347.                             <xsl:with-param name="items" select="$badblocks"/>
  348.                         </xsl:call-template>
  349.                     </xsl:with-param>
  350.                     <xsl:with-param name="c1width" select="$g_c1width"/>
  351.                 </xsl:call-template>
  352.             </xsl:when>
  353.         </xsl:choose>
  354.     </xsl:template>
  355.     
  356.     <!-- Dump -->
  357.     <xsl:template match="sectors">
  358.         <xsl:apply-templates select="sector"/>
  359.     </xsl:template>
  360.     
  361.     <!-- single sector dump  -->
  362.     <xsl:template match="sector">
  363.         <xsl:call-template name="separator"/>
  364.         <xsl:call-template name="row">
  365.             <xsl:with-param name="v1">QT_TRANSLATE_NOOP("QObject", "Sector")</xsl:with-param>
  366.             <xsl:with-param name="v2" select="@address"/>
  367.             <xsl:with-param name="c1width" select="$g_c1width"/>
  368.         </xsl:call-template>
  369.         <xsl:call-template name="separator"/>
  370.         
  371.         <xsl:call-template name="simplerow">
  372.             <xsl:with-param name="v1">
  373.                 <xsl:for-each select="byte"><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:for-each>
  374.             </xsl:with-param>
  375.             <xsl:with-param name="width" select="48"/>
  376.         </xsl:call-template>
  377.     </xsl:template>
  378.     
  379. </xsl:stylesheet>
  380.